@import '../../style/themes/index';
@import '../../style/mixins/index';

@popover-prefix-cls: ~'@{ant-prefix}-popover';

.@{popover-prefix-cls} {
  .reset-component();

  --antd-arrow-background-color: @popover-bg;

  position: absolute;
  top: 0;
  left: 0;
  z-index: @zindex-popover;
  max-width: 100vw;
  font-weight: normal;
  white-space: normal;
  text-align: left;
  cursor: auto;
  user-select: text;

  &-content {
    position: relative;
  }

  &::after {
    position: absolute;
    background: fade(@white, 1%);
    content: '';
  }

  &-hidden {
    display: none;
  }

  &-inner {
    background-color: @popover-bg;
    background-clip: padding-box;
    border-radius: @border-radius-base;
    box-shadow: @box-shadow-base;
  }

  @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* IE10+ */
    &-inner {
      box-shadow: @box-shadow-base;
    }
  }

  &-title {
    min-width: @popover-min-width;
    min-height: @popover-min-height;
    margin: 0; // reset heading margin
    padding: 5px @popover-padding-horizontal 4px;
    color: @heading-color;
    font-weight: 500;
    border-bottom: 1px solid @border-color-split;
  }

  &-inner-content {
    width: max-content;
    max-width: 100%;
    padding: @padding-sm @popover-padding-horizontal;
    color: @popover-color;
  }

  &-message {
    display: flex;
    padding: 4px 0 12px;
    color: @popover-color;
    font-size: @font-size-base;

    &-icon {
      display: inline-block;
      margin-right: 8px;
      color: @warning-color;
      font-size: @font-size-base;
    }
  }

  &-buttons {
    margin-bottom: 4px;
    text-align: right;

    button:not(:first-child) {
      margin-left: 8px;
    }
  }

  // Arrow Style
  .placementArrow(@popover-arrow-width, 4px, @arrow-border-radius, var(--antd-arrow-background-color), @popover-arrow-box-shadow);
}

.generator-popover-preset-color(@i: length(@preset-colors)) when (@i > 0) {
  .generator-popover-preset-color(@i - 1);
  @color: extract(@preset-colors, @i);
  @lightColor: '@{color}-6';

  .@{popover-prefix-cls}-@{color} {
    .@{popover-prefix-cls}-inner {
      background-color: @@lightColor;
    }

    .@{popover-prefix-cls}-arrow {
      background-color: @@lightColor;
    }
  }
}

.generator-popover-preset-color();

@import './rtl';
